import axios from '@/utils/axios';

export const addReviewsSetting = (data) => {
    return axios.request({
        url: '/reviews/setting',
        method: 'post',
        data
    });
};

export const getReviewsSetting = (siteId) => {
    return axios.request({
        url: '/reviews/setting/' + siteId,
        method: 'get'
    });
};

export const getSpuPage = (params) => {
    return axios.request({
        url: '/reviews/spu/page',
        method: 'get',
        params
    });
};

export const addSpuReviews = (data) => {
    return axios.request({
        url: '/reviews',
        method: 'post',
        data
    });
};

export const updateSpuReviews = (data) => {
    return axios.request({
        url: '/reviews/' + data.id,
        method: 'put',
        data
    });
};

export const getReviewsPage = (params) => {
    return axios.request({
        url: '/reviews/page',
        method: 'get',
        params
    });
};

export const getSpuReviewsPage = (params) => {
    return axios.request({
        url: '/reviews/page/spu',
        method: 'get',
        params
    });
};

export const getSpuReviewsDetail = (siteId, spuId) => {
    return axios.request({
        url: '/reviews/spu/' + siteId + '/' + spuId,
        method: 'get'
    });
};

export const deleteReviews = (params) => {
    return axios.request({
        url: '/reviews',
        method: 'delete',
        params
    });
};

export const publishReviews = (params) => {
    return axios.request({
        url: '/reviews/publish',
        method: 'put',
        params
    });
};

export const unPublishReviews = (params) => {
    return axios.request({
        url: '/reviews/unPublish',
        method: 'put',
        params
    });
};

export const starReviews = (params) => {
    return axios.request({
        url: '/reviews/star',
        method: 'put',
        params
    });
};
